<template>
  <div id="def">
    <div class="page-wrap">

      <mt-tab-container class="page-tabbar-container" v-model="show">
          <mt-tab-container-item id="首页">
             <index></index>
          </mt-tab-container-item>

          <mt-tab-container-item id="书库">
             <backpack></backpack>
          </mt-tab-container-item>

          <mt-tab-container-item id="我的">
             <myself></myself>
          </mt-tab-container-item>
      </mt-tab-container>
    </div>

    <mt-tabbar v-model="show" fixed>
      <mt-tab-item id="首页">
        <img slot="icon" @click='changeStatus("首页")' src="../assets/home.png">
        首页
      </mt-tab-item>

      <mt-tab-item id="书库">
        <img slot="icon" @click='changeStatus("书库")' src="../assets/book.png">
        书库
      </mt-tab-item>

      <mt-tab-item id="我的">
        <img slot="icon" @click='changeStatus("我的")' src="../assets/mine.png">
        我的
      </mt-tab-item>
    </mt-tabbar>
  </div>
</template>

<script>
import index from '../components/index.vue'
import backpack from '../components/backpack.vue'
import myself from '../components/myself.vue'
import { mapState } from 'vuex'
        import { mapMutations } from 'vuex'

  export default {
  name: 'def',
  data () {
    return {
    }
  },
  methods: {
        ...mapMutations([
             'changeStatus'// 映射 
       ])

  },
  components: { index,backpack,myself },
  computed:{
           ...mapState({
                show: state => state.show
           })
  }
}
</script>

<style>
#def {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;

}

h1, h2 {
  font-weight: normal;
}

ul {
  list-style-type: none;
  padding: 0;
}

li {
  display: inline-block;
  margin: 0 10px;
}

a {
  color: #42b983;
}




</style>
